package com.itheima.dao;

import java.util.List;

import org.springframework.orm.hibernate5.HibernateTemplate;
import org.springframework.orm.hibernate5.support.HibernateDaoSupport;

import com.itheima.domain.User;

public class UserDao extends HibernateDaoSupport{

	
	@SuppressWarnings("all")
	public User login(User user) {
		System.out.println("userDao。。。");
		List<User> list = (List<User>) this.getHibernateTemplate().find
				("from User where username=? and password=?", user.getUsername(),user.getPassword());
		if (list != null & list.size() != 0) {
			return list.get(0);
		}
		return null; 
	}

}